'''
5.4.1 什么是pandas
'''

import pandas as pd

# 使用 Series

s1 = pd.Series([1,2,3], index=[1,2,3], name='s1')

print(s1)
print(s1.index)
print(s1[1])

# 输出：
# 1    1
# 2    2
# 3    3
# Name: s1, dtype: int64
# Int64Index([1, 2, 3], dtype='int64')
# 1


# 使用 DataFrame

s1 = pd.Series([1, 2, 3], index=[1, 2, 3], name='A')
s2 = pd.Series([10, 20, 30], index=[1, 2, 3], name='B')
s3 = pd.Series([100, 200, 300], index=[1,2,3], name='C')
df = pd.DataFrame([s1, s2, s3])
print(df)

# 输出：
#      1    2    3
# A    1    2    3
# B   10   20   30
# C  100  200  300

df2 = pd.DataFrame({
    s1.name: s1,
    s2.name: s2,
    s3.name: s3
})
print(df2)

# 输出：
#    A   B    C
# 1  1  10  100
# 2  2  20  200
# 3  3  30  300